#pragma once
#include<iostream>
#include<boost/asio.hpp>
#include<memory>
#include<string>
#include<functional>
#include"TcpConnect.h"

class TcpServ
	:public std::enable_shared_from_this<TcpServ>
{
private:
	boost::asio::ip::tcp::acceptor m_acceptor;
	boost::asio::io_context& ioc;

private:
	TcpServ(boost::asio::io_context& ioc);
	void handleAccept(std::shared_ptr<TcpConnect>tcpConnect, const boost::system::error_code& ec);

public:
	static std::shared_ptr<TcpServ> create(boost::asio::io_context& ioc);
	void startAccept();
};